<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<jsp:include page="../../fragments/header.jsp">
	<jsp:param name="title" value="Order Confirmation" />
</jsp:include>

<c:choose>
	<c:when test="${orderStatus == 'DONE'}">
		<ol class="progtrckr">
			<li class="progtrckr-done">Shopping Cart</li>
			<li class="progtrckr-done">Customer Info</li>
			<li class="progtrckr-done">Payment Options</li>
			<li class="progtrckr-done">Finalizing Order</li>
		</ol>
		<br />
		<br />

		<p>Order added successfully</p>
		
		<br /><br />
		<form action="${pageContext.request.contextPath}/product_list_back">
			<button class="btn btn-default">
				<b>Back to Books List</b>
			</button>
		</form>
	</c:when>
	<c:otherwise>

		<ol class="progtrckr">
			<li class="progtrckr-done">Shopping Cart</li>
			<li class="progtrckr-done">Customer Info</li>
			<li class="progtrckr-done">Payment Options</li>
			<li class="progtrckr-todo">Finalizing Order</li>
		</ol>
		<br />
		<br />

		<p>Shopping Cart Items</p><br/>

		<div class="form-horizontal">
			<c:forEach items="${shoppingCartList}" var="product">

				<div class="form-group">
					<label class="label"><b>Book</b></label>
					<label class="data">${product.key.name}, ${product.key.author}</label>
				</div>
				<div class="form-group">
					<label class="label"><b>Quantity</b></label>
					<label class="data">${product.value}</label>
				</div>
				<div class="form-group">
					<label class="label"><b>Price</b></label>
					<label class="data">${product.value} * ${product.key.price} $ = ${product.key.price * product.value} $</label>
				</div>

				<hr />

			</c:forEach>
		
			<div class="form-group">
				<label class="label"><b>Total Price</b></label>
				<label class="data">${totalPrice} $</label>
			</div>
		</div>
		
		<hr /><br /><br />
		
		<form action="${pageContext.request.contextPath}/credit_card_info">
			<button class="btn btn-default">
				<b>Back</b>
			</button>
		</form>
		<form action="${pageContext.request.contextPath}/cancel_order">
			<button class="btn btn-default">
				<b>Cancel Order</b>
			</button>
		</form>
		<form action="${pageContext.request.contextPath}/finish_order">
			<button class="btn btn-default">
				<b>Finish Order</b>
			</button>
		</form>

	</c:otherwise>
</c:choose>

<jsp:include page="../../fragments/footer.jsp" />